package engine;

import java.util.List;

/**
 * Class that gives a template for Mover attributes/properties.
 * Support easy access of information for the attribute as well as
 * easy setting of the attribute's current value.
 * 
 * Implements Comparable to allow for sorting for organized sliders in
 * settings panel
 * 
 * @author jianweigan
 */
public class Attribute implements Comparable<Attribute> {

	private String myName;
	private int myCurrentValue;
	private int myMaxValue;
	private int myMinValue;

	/**
	 * Creates an attribute instance from the given info
	 * @param parametername
	 * @param paramlist List of integers in the format:
	 * { minvalue, current value, maxvalue }
	 */
	public Attribute(String parametername, List<Integer> paramlist) {
		myName = parametername;
		myMinValue = paramlist.get(0);
		myCurrentValue = paramlist.get(1);
		myMaxValue = paramlist.get(2);
	}

	/**
	 * Need get methods to pass attributes to AttributeSlider.
	 */
	public String getName() {
		return myName;
	}

	public int getCurrentValue() {
		return myCurrentValue;
	}

	/**
	 * Need this set method to let associated slider set current value
	 * of attribute.
	 * @param currentValue new value to set currentvalue to
	 */
	public void setCurrentValue(int currentValue) {
		this.myCurrentValue = currentValue;
	}

	/**
	 * Need get min and get max to create sliders
	 */
	public int getMaxValue() {
		return myMaxValue;
	}

	public int getMinValue() {
		return myMinValue;
	}

	/**
	 * Compare based on attribute name
	 */
	public int compareTo(Attribute other) {
		return myName.compareTo(other.myName);
	}

}
